package org.example.service.imp;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.example.mapper.OperateLogMapper;
import org.example.pojo.OperateLog;
import org.example.pojo.PageResult;
import org.example.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImp implements LogService {
    @Autowired
  private  OperateLogMapper operateLogMapper;
    @Override
    public PageResult findLog(int page, int pageSize) {
        PageHelper.startPage(page,pageSize);
        List<OperateLog>  operateLogs = operateLogMapper.findAll();
        Page<OperateLog> p = (Page<OperateLog>) operateLogs;
        return new PageResult<>(p.getTotal(),p.getResult());


    }
}
